function Schedule_Data(data, tableid) {
	var buffer = new StringBuffer();
	$(data).each(function(i,info){
		try{
		info.Context=decodeURI(info.Context);
		}catch(e){}
		buffer.append('<div class="sharelist border-bottom" tableid="'+tableid+'" id="'+info.ID+'" userid="'+info.UserID+'" username="'+info.RealName+'" identity="'+info.Identity+'" state="'+info.State+'">');
		buffer.append('<div class="atitle">');
		buffer.append('<div class="aimg"><img src="'+info.HeadImg+'"/></div>');
		buffer.append('<div class="aname">'+info.RealName+'</div>');
		buffer.append('<div class="adate">'+info.CreateTime+'  &nbsp;&nbsp;&nbsp;&nbsp; 来自&nbsp;'+info.Version+'</div>');
		buffer.append('<div class="atag">日程</div>');
		buffer.append('</div>');
		if(info.RepeatRate=="不重复")
		{
			buffer.append('<div class="aexeuser"><font>'+info.BeginDate.ToDate() + ' ' + info.RemindTime+' 提醒</font>');
		}else{
			buffer.append('<div class="aexeuser">自 <font>'+info.BeginDate.ToDate()+' 起</font>，');
			if(info.RemindTime!="")
			{
				buffer.append(info.RepeatRate + ' ');
				if(info.RepeatRate=="每周")
				{
					buffer.append(GetWeek(info.RepeatDate));
				}
				if(info.RepeatRate=="每月")
				{
					buffer.append((info.RepeatDate.ReplaceAll(",","号,")+"号").replace("31号","最后一天"));
				}
				if(info.RepeatRate=="每年")
				{
					buffer.append(info.RepeatDate.replace("-","月")+"日");
				}
				buffer.append(' ' + info.RemindTime+' 提醒');
			}
		}
		buffer.append('</div>');
		buffer.append('<div class="aimg">');
		$(info.Imgs).each(function(k,img)
		{
		var right=k%3==2?0:5;
		buffer.append('<figure class="asquare" style="width:'+(swidth-30)/3+'px; heigth:'+(swidth-30)/3+'px; margin-right:'+right+'px; float:left; display:block;" itemscope itemtype="http://schema.org/ImageObject"><a src="'+img.Img1000+'" itemprop="contentUrl" data-size="'+img.Width+'x'+img.Height+'"><img src="' + img.Img200 + '" width="'+(swidth-30)/3+'" height="'+(swidth-30)/3+'" itemprop="thumbnail" alt="Image description"/></a></figure>');
		});
		buffer.append('</div>');
		if(info.Files.length>0)
		{
		buffer.append('<div class="afile">');
		$.each(info.Files,function(i,info)
		{
					buffer.append('<div class="file_list">');
						buffer.append('<div class="file_icon"><img src="img/'+GetICON(info.Path)+'"/></div>');
						buffer.append('<div class="file_info">');
							buffer.append('<div class="file_name">' + info.Name + '</div>');
							buffer.append('<div class="file_size">' + GetSize(info.Size) + '</div>');  
						buffer.append('</div>'); 
						buffer.append('<div class="file_download"><a href="javascript:void(0)" onclick=DownLoad(this,"'+info.Path+'")></a></div>');
					buffer.append('</div>');
		});
		buffer.append('</div>');
		}
		buffer.append('<div class="acontent"><span>' + info.Context + '</span><div id="detail">'+info.Context.DHtml().Cut()+'</div></div>');
		
		buffer.append('<div class="atool">');
		if(info.UserID==userid){
		buffer.append('<div class="delete"><img src="img/delete.png" height="12"/></div>');
		}
		buffer.append('</div>');
		buffer.append('</div>');
	});
	return buffer.toString();
};


function Init_Schedule(){
	get("divmsgname").addEventListener("tap",function(){
		OpenOAScreen(Schedule_Search_Code(),function(){
			Init_Schedule_Search();
		},function(){Data_Search(37)});
	});
	
};

function Schedule_Search_Code(){
	var buffer = new StringBuffer();
	buffer.append('<div class="searchline"><div class="names">关键字</div><div class="option"><input id="keyword_search" type="text" placeholder="搜索关键字" /></div></div>');
	buffer.append('<div class="searchline"><div class="names">发布时间</div><div class="option"><input id="begindate_search" type="text" class="date" placeholder="开始时间" readonly="readonly"/><input id="enddate_search" type="text" class="date" placeholder="结束时间" readonly="readonly"/></div></div>');
	return buffer.toString();
};

function Init_Schedule_Search(){
	
	mui(".option").on("tap",".date",function(){
		obj=this;
			var t=new Date();
			if($(this).val()!="")
			{
				var year_month_day=$(this).val().split("-");
				t.setFullYear(year_month_day[0]);
				t.setMonth(year_month_day[1]-1);
				t.setDate(year_month_day[2]);
			}
			plus.nativeUI.pickDate( function(e){
				var d=e.date;
				$(obj).val((d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate()).ToDate());
			},function(e){
				console.log( "未选择日期："+e.message );
			},{date:t});
	});
};